<template>
	<view class="content">
		<view>
			<button @click="getDataError">发送一个失败请求</button>
			<button @click="getDataSucc">发送一个成功请求</button>
		</view>
		<view class="">
			<view class="" @click="goToPage('/pages/index/login')">登录</view>
		</view>
		<view class="" @click="goToPage('/pages/make-order/index')">
			<text>出单</text>
		</view>
		<view class="" @click="goToPage('/pages/query-order/index')">
			<text>订单查询</text>
		</view>
		<view class="" @click="goToPage('/pages/test/index')">
			<text>白名单页面测试</text>
		</view>
	</view>
</template>

<script setup lang="ts">
import { postRequestAPI } from './api';

const getDataError = async () => {
	try {
		const res = await postRequestAPI({ test: 'error' });
	} catch (e) {
		console.log('catch 请求失败', e);
	}
}
const getDataSucc = async () => {
	try {
		const res = await postRequestAPI({ test: 'succ' });
	} catch (e) {
		console.log('catch 请求失败', e);
	}
}
const goToPage = (url : string) => {
	uni.navigateTo({ url });
}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>